package net.pugsplace.gpremacy.state;

import net.pugsplace.gpremacy.rules.Resource;

/** Immutable objects */
public class AbstractResource implements Resource {
	private static final long serialVersionUID = -1285830841862086339L;

	private final String name;

	public AbstractResource(String n) {
		name = n;
	}

	public int compareTo(Resource o) {
		return name.compareTo(o.getName());
	}

	@Override
	public boolean equals(Object obj) {
		return name.equals(((AbstractResource) obj).getName());
	}

	public String getName() {
		return name;
	}

	@Override
	public int hashCode() {
		return name.hashCode();
	}

	@Override
	public String toString() {
		return getName();
	}

}
